﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Data;
using GPCSC.Webs;

namespace GPCSC.Web.SHFW
{
    public class CL_PY
    {
        DataSet ds = new DataSet();
        public CL_PY()
        { 
        
        }
        
        /// <summary>
        /// 根据用户id 绑定用户的评议信息
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public DataSet F_bound(string userid)
        {
            ds.Clear();
            Hashtable htable = new Hashtable();
            htable.Add("@userid",userid);
            ds = new GPCSC.Webs.SqlReadXml().ReaderDataSet("selpy_byuserid",htable);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (dr["zt"].ToString() == "0")
                        {
                            dr["zt"] = "未服务";
                        }
                        else if (dr["zt"].ToString() == "1")
                        {
                            dr["zt"] = "已服务";
                        }
                    }
                }

            }
            return ds;

        }
       /// <summary>
       /// 冲浪售后服务列表
       /// </summary>
       /// <param name="userid"></param>
       /// <returns></returns>
        public DataSet CLF_bound()
        {
            ds.Clear();
            Hashtable htable = new Hashtable();
            
            ds = new GPCSC.Webs.SqlReadXml().ReaderDataSet("selpy_CL", htable);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (dr["zt"].ToString() == "0")
                        {
                            dr["zt"] = "未服务";
                        }
                        else if (dr["zt"].ToString() == "1")
                        {
                            dr["zt"] = "已服务";
                        }
                    }
                }

            }
            return ds;

        }
        /// <summary>
        /// 根据id  获取一则记录
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public DataSet CLF_boundById(string ids)
        {
            ds.Clear();
            Hashtable htable = new Hashtable();
            htable.Add("@pyid",ids);
            ds = new GPCSC.Webs.SqlReadXml().ReaderDataSet("selpy_byid", htable);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (dr["zt"].ToString() == "0")
                        {
                            dr["zt"] = "未服务";
                        }
                        else if (dr["zt"].ToString() == "1")
                        {
                            dr["zt"] = "已服务";
                        }
                    }
                }

            }
            return ds;

        }
    }
}